package handlers

import (
	"team-mng-sys/models"

	"github.com/gin-gonic/gin"
)

func Add(c *gin.Context) {
	name := c.PostForm("name")
	address := c.PostForm("address")
	data := models.Ck{
		Name:    name,
		Address: address,
	}
	if name == "" || address == "" {
		c.JSON(200, gin.H{
			"code": 400,
			"msg":  "不能为空",
		})
		return
	}
	models.DB.Create(&data)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "添加成功",
	})
	return
}
